    
    
    List<scalar> addBedLengths;
  
    // 使用 C++11 随机数生成器  
    std::random_device rd;              // 真随机数种子  
    std::mt19937 gen(rd());             // Mersenne Twister 伪随机数生成器  
    std::uniform_real_distribution<scalar> dist(minValue, maxValue); // 随机数范围为 [minValue, maxValue]  

    point addBedLengthLoc(Zero); 

    const polyBoundaryMesh& patches = mesh.boundaryMesh();
    // 生成随机数
    forAll(patches, patchI)
    {
        if(patches[patchI].name() == bedPatchName)
        {
            const polyPatch& patch = patches[patchI];
            const vectorField& bedFaceCenters  = patch.faceCentres();
            const label bed_face_size = bedFaceCenters.size();
            addBedLengths.setSize(bed_face_size);
            forAll(addBedLengths, i)
            {
                addBedLengths[i] = dist(gen);
                Info << "Random number = " << addBedLengths[i] << endl;
            }
        }
    }

    // 遍历所有边界Patch
    forAll(patches, patchI) // for (label patchI ; patchI < patches.size() ; ++patchI)
    {
        if(patches[patchI].name() == bedPatchName)
        {
            const polyPatch& patch = patches[patchI];
            
            Info<< "\nProcessing Bed patch: " << patch.name() << nl;

            const vectorField& bedFaceCenters  = patch.faceCentres();
            const vectorField& faceNormals     = patch.faceNormals();

            forAll(bedFaceCenters, faceI)
            {
                scalar cosTheta = faceNormals[faceI] & refDir;
                scalar angleDeg = Foam::acos(cosTheta) * 180.0 / M_PI;
                Info <<"["<< faceI <<"] 夹角大小 = " << angleDeg << endl;
                if(true) // NOTE:  Special case
                {
                    label  globalFaceI   = faceI + patch.start();
                    label  test_glofaceI = faceI + mesh.boundary()[patchI].start();
                    //Info  <<"globalFaceI : " << globalFaceI << ", test_glofaceI : " << test_glofaceI << endl;
                    label size_face = mesh.faces()[globalFaceI].size();
                    
                    //Info << "On bed patch, face got : " << size_face << " vertices: " << endl;

                    pointList pNearBface(size_face,Zero);
                    pointList pNearAface(size_face,Zero);

                    forAll(mesh.faces()[globalFaceI], vertI)
                    {
                        //          ^z
                        //          |
                        //  3__2    |___> x 
                        //  |__|
                        //  0  1
                        pNearBface[vertI] = mesh.points()[mesh.faces()[globalFaceI][vertI]];
                        //Info  << "   "  << pNearBface[vertI] << endl;
                    }                 
                    
                    point sub_min_point = findMinBox(pNearBface);

                    Info << "Add random length,\n addBedLengths[faceI] * Foam::cos(angleDeg) = " << addBedLengths[faceI] * Foam::cos(angleDeg)
                         << "\n std::abs(addBedLengths[faceI] * Foam::sin(angleDeg) = " << addBedLengths[faceI] * Foam::sin(angleDeg)
                         << endl;
                    // TODO: 尝试将这段替换为用网格拓扑的接口来做。
                    addBedLengthLoc[0] = bedFaceCenters[faceI].x();
                    addBedLengthLoc[1] = bedFaceCenters[faceI].y()  + std::abs(addBedLengths[faceI] * Foam::cos(angleDeg));
                    addBedLengthLoc[2] = bedFaceCenters[faceI].z()  + std::abs(addBedLengths[faceI] * Foam::sin(angleDeg));
                    point upperPoint = addBedLengthLoc;
                    point upper_max_point(Zero);
                    label nearestCell = mesh.findCell(upperPoint);
                    //Info << "Nearest cell to upper point: " << nearestCell << endl;

                    if(nearestCell == -1)
                    {
                        Info << "问题点，跳过" << endl;
                        continue;
                    }

                    // 取得目标单元的面列表  
                    const labelList& cellFaces = mesh.cells()[nearestCell]; // 当前单元的 faces 的索引  
                    //Info << "Cell " << nearestCell << " has " << cellFaces.size() << " faces:" << endl;  
                    // 遍历每个面  
                    forAll(cellFaces, faceIndex)  
                    {  
                        label localFace = cellFaces[faceIndex]; // 对应面索引  
                        //Info << "Face #" << localFace << " located at cell:\n";  

                        forAll(mesh.faces()[localFace], vertI)
                        {
                            pNearAface[vertI] = mesh.points()[mesh.faces()[localFace][vertI]];
                            //Info  << "   "  << pNearAface[vertI] << endl;
                            upper_max_point = findMaxBox(pNearAface);
                        }   
                        // Info << "Sub min point" << sub_min_point << "\n"
                        // << "Upper max point: " << upper_max_point << endl;
                        boxFile << "("  << sub_min_point[0] << " " //sub point
                                        << sub_min_point[1] << " "
                                        << sub_min_point[2] << ")"
                                << "("  << upper_max_point[0] << " " //upper point
                                        << upper_max_point[1] << " " 
                                        << upper_max_point[2] << ")"
                                        << "" << endl;                    
                    }

                    



                //    boxFile << "(" << bedFaceCenters[faceI].x() << " " //sub point
                //            << bedFaceCenters[faceI].y() << " " 
                //            << bedFaceCenters[faceI].z()  << ")" 
                //            << "(" << addBedLengthLoc[streamDir]<< " "  // upper point
                //            << addBedLengthLoc[1]  << " " 
                //            << bedFaceCenters[faceI].z()  << ")\n";
                //    Info <<"---------------" << endl;  
                }
                else
                {
                    FatalError  
                    << "NOT IMPLEMENTED..."  
                    << exit(FatalError);  
                }

                // 写入CSV文件
                outputFile << patch.name() << ","
                            << faceI << ","
                            << "plane!" << endl;
            }
            
            break;
        }
    }